package com.pocket.demo.base.api;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Schema(description = "分页信息")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageResult<T> implements Serializable {

    private static final long serialVersionUID = -7216982291829766958L;

    @Schema(description = "当前页", requiredMode = Schema.RequiredMode.REQUIRED)
    private long current;

    @Schema(description = "页大小", requiredMode = Schema.RequiredMode.REQUIRED)
    private long size;

    @Schema(description = "总页数")
    private long pages;

    @Schema(description = "数据量")
    private long total;

    @JsonIgnore
    @Schema(description = "数据")
    private List<T> data;

    public PageResult(long total, List<T> data) {
        this.total = total;
        this.data = data;
    }
}
